/* $Id: Stats.java 77 2009-04-20 21:46:34Z henk $ */
package org.jugger.tournament.model;

/**
 * @author Sven Hamer
 */
public class Stats {

	private int nbWin;
	private int nbDraw;
	private int nbLost;
	private int pointsPositive;
	private int pointsNegative;
	private int scorePositive;
	private int scoreNegative;

	public Stats() {
		this(0,0,0,0,0,0,0);
	}

	public Stats(int nbWin, int nbDraw, int nbLost, int pointsPositive,
			int pointsNegative, int scorePositive, int scoreNegative) {
		this.nbWin = nbWin;
		this.nbDraw = nbDraw;
		this.nbLost = nbLost;
		this.pointsPositive = pointsPositive;
		this.pointsNegative = pointsNegative;
		this.scorePositive = scorePositive;
		this.scoreNegative = scoreNegative;
	}

	public Stats(Stats currentStats, Stats diffStats) {
		this(
				currentStats.getNbWin()+diffStats.getNbWin(),
				currentStats.getNbDraw()+diffStats.getNbDraw(),
				currentStats.getNbLost()+diffStats.getNbLost(),
				currentStats.getPointsPositive()+diffStats.getPointsPositive(),
				currentStats.getPointsNegative()+diffStats.getPointsNegative(),
				currentStats.getScorePositive()+diffStats.getScorePositive(),
				currentStats.getScoreNegative()+diffStats.getScoreNegative()
			);
	}

	public int getNbWin() {
		return nbWin;
	}

	public int getNbDraw() {
		return nbDraw;
	}

	public int getNbLost() {
		return nbLost;
	}

	public int getPointsPositive() {
		return pointsPositive;
	}

	public int getPointsNegative() {
		return pointsNegative;
	}

	public int getScorePositive() {
		return scorePositive;
	}

	public int getScoreNegative() {
		return scoreNegative;
	}



	public int getNbMatches() {
		return nbWin+nbDraw+nbLost;
	}

	public int getPointsDifference() {
		return pointsPositive - pointsNegative;
	}

	public int getScoreDifference() {
		return scorePositive - scoreNegative;
	}

	@Override
	public String toString() {
		return "W/D/L: "+nbWin+"/"+nbDraw+"/"+nbLost+", P:"+pointsPositive+"/"+pointsNegative+", S:"+scorePositive+"/"+scoreNegative;
	}

	public Stats negate() {
		return new Stats(-nbWin, -nbDraw, -nbLost, -pointsPositive, -pointsNegative, -scorePositive, -scoreNegative);
	}
}
